package mest.controller.hws;

import com.alibaba.fastjson.JSONArray;
import mest.service.hws.warehouse_workfinishService;
import mest.service.system.DBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/warehouse_workfinishController")
@CrossOrigin
public class warehouse_workfinishController {

    @Resource
    private warehouse_workfinishService ww;

    @Autowired
    private DBService dbService;

    @RequestMapping("/insert")
    public void insert(@RequestBody JSONArray json) {
        String theirDb = dbService.getCompanyDB();
        System.out.println("进入新方法:" + json.toJSONString());
        List<Map<String,Object>> map= json.toJavaObject(List.class);

        System.out.println("单条数据:" + map.get(0));
        ww.insertModel(theirDb,map);
    }
}
